//
//  ValueTableViewCell.m
//  任务列表练习
//
//  Created by apple on 15/9/16.
//  Copyright (c) 2015年 戴维营. All rights reserved.
//

#import "ValueTableViewCell.h"
#import "ThreeViewController.h"

@implementation ValueTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier

{
    if (self = [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier])
    {
        _colorView = [[UIView alloc] init];
        //设置圆角
        
        _colorView.layer.cornerRadius = 5;
        
        //往cell上添加子视图时，应该添加到contentView上
        
        [self.contentView addSubview:_colorView];
        
        self.enterButton = [UIButton buttonWithType:UIButtonTypeSystem];

        [self.contentView addSubview:_enterButton];

        [_colorView mas_makeConstraints:^(MASConstraintMaker *make)
         {
             make.left.equalTo(@(10));
             
             make.top.equalTo(@(6));
             
             make.size.equalTo(MASBoxValue(CGSizeMake(10, 32)));
         }];
        
        //    //创建一个某种样式的按键
        //    _enterButton = [UIButton buttonWithType:UIButtonTypeSystem];
        //
        //    //按键的标题
        //    [_enterButton setTitle:@">" forState:UIControlStateNormal];
        //
        
        [_enterButton mas_makeConstraints:^(MASConstraintMaker *make)
         {
             make.top.equalTo(@(6));
             make.right.equalTo(@(-10));
             make.size.equalTo(MASBoxValue(CGSizeMake(20, 20)));
         }];
        
        
        [self.imageView mas_makeConstraints:^(MASConstraintMaker *make)
         {
             make.top.equalTo(@(6));
             make.right.equalTo(_enterButton.mas_left).offset(-5);
             make.size.equalTo(MASBoxValue(CGSizeMake(30, 32)));
             
         }];
        
        [self.textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.top.equalTo(@(5));
            make.left.equalTo(_colorView.mas_right).offset(5);
            make.size.equalTo(MASBoxValue(CGSizeMake(250, 15)));
        }];
        
        [self.detailTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.top.equalTo(self.textLabel.mas_bottom).offset(5);
            make.left.equalTo(_colorView.mas_right).offset(2);
            make.size.equalTo(MASBoxValue(CGSizeMake(250, 9)));
        }];

    }
    
    return self;
}


@end
